Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add destination cluster info to response cookie #466

Merged

Conversation

harishnelakurthi
Copy link
Contributor

@harishnelakurthi harishnelakurthi commented Sep 10, 2024

Description

Add destination cluster a query is routed to in the cookie. More details here of the use-case here: #465

Fixes #465

Release notes

* The cookie data for requests to `/v1/statement` API would include the cluster to which a query got routed named as `trinoClusterHost`.

@willmostly
Copy link
Contributor

I think a Cookie would be more appropriate than adding a new header. Typically headers implement the protocol, and cookies are used for storing session information and passing data back and forth

Copy link

cla-bot bot commented Sep 12, 2024

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@willmostly
Copy link
Contributor

@harishnelakurthi please sign the CLA so that we can take this forward, and address all comments. Please squash your commits as well.

@harishnelakurthi
Copy link
Contributor Author

@willmostly - I have signed the CLA and emailed a week ago. Also, I've addressed all the comments on the PR except there was an open question which I have responded to the reviewer. Let me know if anything is needed from my end.

@willmostly
Copy link
Contributor

@harishnelakurthi I think you may have missed my comment above. I would like to avoid adding a new header just to pass back information unrelated to the routing protocol. This should be a cookie. You can also update the logic such that the cookie is only added/updated in the response to a POST to v1/statement. Please update the PR title and description to reflect the change as well.

Copy link

cla-bot bot commented Sep 18, 2024

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@harishnelakurthi harishnelakurthi changed the title Add destination backend host to response headers for a query Add destination backend host to response cookie Sep 18, 2024
@harishnelakurthi
Copy link
Contributor Author

Thanks, @willmostly I have made the changes to pass this data via session cookie. Please review and let me know if any changes are needed. Also, updated the PR title and description. Will squash the commits before merge.

@andythsu
Copy link
Member

andythsu commented Sep 19, 2024

Can we change the PR name and commit title to "cluster" instead of "backend"

@harishnelakurthi harishnelakurthi changed the title Add destination backend host to response cookie Add destination cluster info to response cookie Sep 19, 2024
@cla-bot cla-bot bot added the cla-signed label Sep 19, 2024
@willmostly
Copy link
Contributor

@harishnelakurthi you can use Airlift's codestyle in your IDE to avoid builds failing due to checkstyle https://github.com/airlift/codestyle

Copy link
Contributor

@willmostly willmostly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty close % comments.

Can you add a test for this functionality? TestGatewayHaMultipleBackend should have the infrastructure you need

Copy link
Contributor

@willmostly willmostly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor code comments and some additional testing

Copy link
Contributor

@willmostly willmostly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is ready. Please remove the stray newline from the testQueryDeliveryToMultipleRoutingGroups method and we can get this merged

@ebyhr
Copy link
Member

ebyhr commented Sep 24, 2024

Please squash commits into one.

@trinodb trinodb deleted a comment from cla-bot bot Sep 24, 2024
@trinodb trinodb deleted a comment from cla-bot bot Sep 24, 2024
@trinodb trinodb deleted a comment from cla-bot bot Sep 24, 2024
@harishnelakurthi
Copy link
Contributor Author

@ebyhr @willmostly Addressed all the comments.If there are no comments I can squash all the commits and would appreciate merging this in as it's been hanging around for a while.

@ebyhr

This comment was marked as resolved.

@harishnelakurthi harishnelakurthi force-pushed the harish/add-cluster-host-response-headers branch 2 times, most recently from 86d573f to 724f2e8 Compare September 24, 2024 07:31
@harishnelakurthi
Copy link
Contributor Author

@ebyhr - I've addressed all the comments on this. Can this be merged please?

Copy link
Member

@ebyhr ebyhr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good except for comments.

@ebyhr
Copy link
Member

ebyhr commented Sep 26, 2024

@harishnelakurthi Please squash commits into one.

@harishnelakurthi harishnelakurthi force-pushed the harish/add-cluster-host-response-headers branch from 9a02d1d to 6ed62bc Compare September 26, 2024 21:29
@harishnelakurthi
Copy link
Contributor Author

Thanks a lot @ebyhr for all the comments. I've squashed all the commits. Can you merge the PR if it's all good? Let me know if anything else needs to be done. Thanks!

@ebyhr

This comment was marked as resolved.

@ebyhr ebyhr force-pushed the harish/add-cluster-host-response-headers branch from 6ed62bc to e528dbf Compare September 27, 2024 08:54
@ebyhr ebyhr merged commit 12ccb3b into trinodb:main Sep 27, 2024
3 checks passed
@github-actions github-actions bot added this to the 12 milestone Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Return the cluster that was used in the query execution as response metadata
5 participants